<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Document</title>
    <script src="jquery-2.1.4.min.js"></script><!--这是jq的外联文件  必须在所有引用的script文件之前 因为要首先调用它才可以-->
    <style>
        *{
            margin: 0;
            padding: 0;
        }
        .box{
            width: 200px;
            height: 200px;
            border: 1px solid gray;
        }
        .box a{
            display: inline-block;
            width: 180px;
            height: 180px;
            border: 1px solid gray;
            margin: 10px 10px;
        }
        .box a i{
            margin: 15px 10px;
            display: inline-block;
            width: 150px;
            height: 150px;
            border: 1px solid gray;
            text-align: center;
            line-height: 150px;
            font-style: normal;
        }
    </style>
</head>
<body>
<div class="box">
    <a href="javascript:;">
        <i>这是i标签</i>
    </a>
</div>
<div class="box2">
    <a href="javascript:;">
        <p class="p">a标签下的p元素</p>
    </a>
    <p class="p">子元素</p>
    <p class="p">子元素</p>
    <p class="p">子元素</p>
    <p class="p">子元素</p>
    <p class="p">子元素</p>
    <p class="p">子元素</p>
</div>
<button class="btn">children</button>
<button class="btn1">children2</button>
<script>
    $(document).ready(function(){
        $(".btn").click(function(){
            $("a").children().css("background","red");  /*直接父元素 就是第一个父元素*/
        })
        $(".btn1").click(function(){
            $(".box2").children("p.p").css("color","yellow");    /*类名是box2下的直接子元素类名为p的p标签*/
        })
    })
</script>
</body>
</html>